<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Vue-HashRouter</title>
    <style>
        body {
            margin: 0;
            height: 100vh;
        }
        #app {
            display: flex;
            flex-direction: column;
            height: 100%;
        }
        .nav {
            display: flex;
            background-color: skyblue;
        }
        .nav a{
            padding: 20px 10px;
            text-decoration: none;
        }
        .nav a:link, .nav a:visited, .nav a:hover, .nav a:active {
            font-size: 20px;
            color: #333;
        }
    </style>
</head>
<body>
    <div id="app">
        <nav class="nav">
            <router-link to="/">主页</router-link>
            <router-link to="/about">关于</router-link>
        </nav>
        <router-view style="background: #ffffff;;text-align:center;flex: 1;padding:20px" />
    </div>
    <script src="https://cdn.jsdelivr.net/npm/vue@2.6.12"></script>
    <script src="./Vue-Router-Hash.js">
    </script>
    <script>
        Vue.use(VueRouter)
        const routes = [
            {
                name: 'home',
                path: '/',
                component: { template: '<div>主页</div>' }
            },
            {
                name: 'about',
                path: '/about',
                component: { template: '<div>关于</div>' }
            }
        ]
        // 实例化Vue-Router对象
        const router = new VueRouter({ routes })
        const app = new Vue({
            router // 注入路由对象
        }).$mount('#app')
        console.log(app)
    </script>
</body>
</html>